//index.js
//获取应用实例
const app = getApp()
Page({
  data:{
     array: ['美国', '中国', '巴西', '日本'],
     index:'请选择课程',
     rowFocusStyle: {color:'#ccc'},
     rowDftStyle:{color:'#333'},
     phone:'',
  },
  onShareAppMessage: function (res) {
    if (res.from === 'button') {
      // 来自页面内转发按钮
      console.log(res.target)
    }
    return {
      title: '俩好人',
      path: '/pages/index/index',
      success: function(res) {
        // 转发成功
      },
      fail: function(res) {
        // 转发失败
      }
    }
  },
  bindPickerChange: function(e) {
    console.log('picker发送选择改变，携带值为', e.detail.value)
    this.setData({
      index: e.detail.value
    })
  },
  getAge:function(e) {
    console.log(e)
  },
  getPhone:function(e){
    var data=e.detail.value;
    data = data.replace(/\s*/g, "");
    var result = [];
    for(var i = 0; i < data.length; i++)
    {
        if (i==3||i==7)
        {
            result.push(" " + data.charAt(i));
        }
        else
        {
            result.push(data.charAt(i));
        }
    }
    this.setData({
        phone:result.join("")
    })

  }


})
//wxa7d01d01f72763e2

